Skip to content

Conversation

@lovasoa
Copy link
Collaborator

@lovasoa lovasoa commented Sep 16, 2025

Add Clippy to GitHub Actions to enforce a warning-free codebase across all feature flag combinations and fix a needless_doctest_main clippy warning.

The CI setup now runs Clippy with various combinations of runtime, TLS, and database features to ensure comprehensive coverage and prevent "unused imports" or other feature-specific warnings from being introduced.


Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Sep 16, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

cursoragent and others added 25 commits September 16, 2025 12:53
This change adds the 'q lifetime bound to the Execute trait in various executor implementations. This ensures that the query parameters live long enough for the query to be executed, preventing potential lifetime issues.

Co-authored-by: contact <[email protected]>
- Fix non-binding let on future by spawning close() future
- Replace map_or(false, ...) with is_some_and(...)
- Remove needless borrow in Arc::clone()
- Fix let_underscore_future by explicitly dropping the future
- Remove unused type parameter DB from deadline_as_timeout function
- Fix reference to reference pattern in query.rs
- Remove redundant closure using and_then directly
- Remove needless borrows in io/buf.rs and logger.rs
- Replace iter().cloned().collect() with to_vec() for better performance
- Use std::io::Error::other() instead of Error::new(ErrorKind::Other)
- Remove reference patterns in query.rs match statements
- Fix unneeded return statements in net/tls/mod.rs
- Remove explicit deref in postgres/column.rs
- Revert redundant closure fix that caused compilation error
- Remove explicit derefs that would be done by auto-deref
- Fix needless borrows in various modules
- Replace is_digit(10) with is_ascii_digit()
- Fix doc list indentation in postgres/copy.rs
- Remove redundant closures in lquery and ltree types
- Fix auto-deref issues in postgres options parser
- Fix auto-deref issues in postgres type_info
- Fix Cow<str> to Path conversions by using value.as_ref()
- Remove unnecessary mut from variable declaration
- Apply various automatic clippy fixes for redundant code
- Remove unused mut from variable declaration
- Remove unused lifetime parameter
- Remove legacy numeric constant import
- Simplify boolean expression using De Morgan's law
- Box the TlsStream variant to reduce enum size
- Rename from_iter methods to avoid confusion with std trait
- Update all pattern matches to handle boxed variant
- Remove empty line after doc comment in tls_prelogin_stream_wrapper.rs
- Fix needless_borrow in ustr.rs, logger.rs, any/statement.rs
- Fix unneeded_return in logger.rs
- Add allow for large_enum_variant in AnyConnectionKind
- Fix never_loop in postgres time_tz.rs by simplifying DateTime parsing
- Fix module_inception by renaming time module to time_impl
- Fix manual_div_ceil using div_ceil method
- Fix deref which would be done by auto-deref in sqlite/column.rs
- Fix wrong_self_convention by making as_int take &self
- Fix useless_conversion and needless_borrow in sqlite/connection/execute.rs
- Fix match_like_matches_macro by using is_some() in logger.rs
- Fix needless_borrow warnings in sqlite/connection/execute.rs
- Fix ptr_arg by using slice instead of Vec reference
- Fix clone_on_copy by dereferencing instead of cloning
- Fix needless_return by removing redundant return keyword
- Fix explicit_counter_loop by using enumerate()
- Fix unused_mut in sqlite/connection/execute.rs
- Fix manual_inspect by using inspect instead of map
- Fix derivable_impls by deriving Default for sqlite option enums
- Fix map_clone by using copied() method
- Fix legacy_numeric_constants by using i32::MAX instead of importing
- Fix unnecessary_cast in sqlite/statement/virtual.rs
- Add is_empty() method to MySqlArguments to fix len_without_is_empty
- Fix explicit_auto_deref in mysql/column.rs and mysql/options/parse.rs
- Fix needless_borrows_for_generic_args in mysql/connection/auth.rs
- Fix borrow_deref_ref in mysql/connection/auth.rs
- Fix needless_borrow in mysql/connection/auth.rs and executor.rs
- Remove unused lifetime in mysql/connection/executor.rs
- Fix get_first by using first() instead of get(0)
- Fix explicit_auto_deref in mysql/options/parse.rs and mysql/transaction.rs
- Replace manual Default impl with derive for MySqlSslMode
- Add allow for enum_variant_names in AuthPlugin (breaking change to fix)
- Fix get_first by using first() instead of get(0)
- Fix unnecessary_cast by removing redundant casts
- Fix map_clone by using copied() method in row and statement modules
- Fix let_and_return in mysql/types/float.rs
- Fix needless_borrows_for_generic_args in chrono and time modules
- Fix len_zero by using is_empty()
- Fix unnecessary_cast by removing redundant type casts
- Fix unwrap_or_default usage
- Fix needless_borrow in json module
- Fix needless_option_as_deref in value module
- Fix get_first by using first() instead of get(0)
- Fix needless_return in migrate module
- Fix op_ref by using direct comparison in mysql/migrate.rs
- Fix needless_borrows_for_generic_args in mysql/testing/mod.rs
- Fix drop_non_drop by using let binding instead of drop
- Fix single_char_add_str by using push() with char literal
- Fix explicit_auto_deref in mssql/column.rs and establish.rs
- Fix io_other_error by using std::io::Error::other()
- Fix unnecessary_map_or by using is_some_and()
- Fix unit_arg by using Default::default()
- Add allow for let_unit_value due to platform differences
- Fix unit_arg by using () instead of Default::default()
- Fix redundant_closure by using function reference directly
- Fix while_let_on_iterator by using for loop
- Fix explicit_auto_deref in mssql/options/parse.rs
- Add allow for result_large_err in requested_packet_size
- Fix needless_range_loop by iterating over slice directly
- Add allow for ptr_arg where Vec-specific methods are used
- Fix unused_mut in mssql/io/buf_mut.rs
- Fix useless_conversion by removing redundant .into()
- Fix manual_div_ceil by using div_ceil method
…am_wrapper

- Return 0 for async-std and () for tokio in poll_read
- Fixes compilation with runtime-async-std-rustls feature
- Fix deprecated chrono DateTime::from_utc usage
- Add workspace lint config to allow postgres_14 cfg
- Fix dead code warnings in sqlx-macros query data
- Fix needless_borrows_for_generic_args in sqlx-macros
- Fix useless_conversion by removing redundant .into()
- Fix useless_vec by using array instead of vec! in test
@lovasoa

This comment was marked as resolved.

@cursor

This comment was marked as resolved.

- Change DateTime::from_naive_utc_and_offset to DateTime::<Utc>::from_naive_utc_and_offset in chrono tests
- Removed the unused RangeInclusive struct from derives.rs
- Added #[allow(unused_imports)] to macros.rs and types.rs to suppress warnings
- Removed clippy job and integrated checks into existing jobs for core, root, and all targets.
- Added clippy checks for sqlite, postgres, mysql, mariadb, and mssql with specific features.
- Enhanced CI workflow efficiency by consolidating clippy steps.
…n tests

- Added 'cfg(postgres_9_6)' to the lint configuration in Cargo.toml.
- Suppressed unused import warnings in various test files for better clarity and maintainability.
- Adjusted assertions in MySQL tests for boolean values to use assert! macro.
- Included additional imports for Executor and Row in pool.rs and types.rs respectively.
- Suppressed unused import warnings to enhance code clarity.
…rt warnings

- Deleted the test_all_features.sh script to streamline the testing process.
- Added unused import suppressions in test_attr.rs and mssql.rs for improved code clarity.
- Renamed the method from_label_iter to from_iter in PgLTree to align with naming conventions and improve clarity.
@lovasoa lovasoa marked this pull request as ready for review September 17, 2025 06:09
@lovasoa lovasoa merged commit 98ad187 into main Sep 17, 2025
63 checks passed
@lovasoa lovasoa deleted the cursor/address-clippy-warnings-and-add-to-gh-actions-06da branch September 17, 2025 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants